%% Copyright (C) 2007 Vijay Gajula <gajulak@gmail.com>.
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions
%% are met:
%%
%% 1. Redistributions of source code must retain the above copyright
%%    notice, this list of conditions and the following disclaimer.
%% 2. Redistributions in binary form must reproduce the above
%%    copyright notice, this list of conditions and the following
%%    disclaimer in the documentation and/or other materials provided
%%    with the distribution.
%%
%% THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
%% OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
%% WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
%% ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
%% DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
%% DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
%% GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
%% WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
%% NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
%% SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-define(INFO(X), error_logger:info_report({?MODULE, ?LINE, X})).
-define(ERROR(X), error_logger:error_report({?MODULE, ?LINE, X})).

-record(handlers, {module, function}).

-record(device, { name,
		  ip,
		  cert
		}).
-record(route, { 
		 address,
		 netmask,
		 gateway,
		 interface
		}).
		
-record(interface, { name,
		     ipaddress,
		     netmask,
		     type, 			%% internal, external
		     mtu = 1500,
		     status = enabled 		%% enabled,disabled
		     }).

-record(dhcpserver, { 
			 name,
			 startip,
			 endip,
			 gateway,
			 dnsserver,
			 lease_hrs,
			 lease_mins,
			 status
			 }).

-record(dnsserver, {
			hostname,
			ipaddress
			}).

-record(user, {
		name,
		passwd,
		passwd_expiry,
		admin,
		nonadmin,
		certificate,
		ipsecvpn,
		sslvpn,
		pptpvpn,
		bandwidth,              %% Data Rate
		access_start_time,			  %% Access Restrictions
		access_end_time,			  %% Access Restrictions
		access_days,
		status
		%% login_start_time
		%% url_white_list
		%% url_black_list
		%% urls_visted
		%% bandwidth_usage
		%% chat_id          %% yahoo, gmail, 
		%% used_protocols  service(ftp/telnet...), time, data_transfered
		%% virus_found
		%% spam_sent 		 %% emails sent
		%% open_ports      %% shows current open ports
		%% mac_address
		%% ip_address
		%% hostname
		%% location,        %% build location
		%% cube,			   %% cube or room number
		%% port,			   %% socket number for ethernet connection.
		%% login_end_time,
		}).

-record(ipsecvpn, {
		name,
		local_id_type = ip,   %% ip, fqdn, ufqdn, dn
		local_id,  
		remote_ip,
		remote_id_type = ip,   %% ip, fqdn, ufqdn, dn
		remote_id,
		auth_type = preshared,   %% preshared, certificate
		mode = main,		 	 %% main, aggressive
		auth_alg = sha1,    	 %% md5, sha1, sha2
		enc_alg = aes256,     	 %% 3des, aes128, aes192, aes256
		secret,      			   %% incase of preshared key
		certificate, 			   %% incase of certifcate
		keylife = 48,     		  %% in hrs, 2days
		dh_group = 2,	 		  %% group1, group2, group5
		ipsec_protocol = esp,  	 	 %% ah,esp
		ipsec_auth_alg = sha1,  	 %% md5, sha1, sha2
		ipsec_enc_alg  = aes256,  	 %% 3des, aes128, aes192, aes256
		ipsec_keylife  = 24,    	 %% in hrs, 1 day
		ipsec_lifebytes  = 0,    	 %% in GBs, 0 - unlimted 
		pfs = yes,
		dpd = yes,     			   %% yes or no
		nat_traversal = yes,
		status = enabled
		}).
